Skip to content

document the delete organization sub account endpoint - #56

Merged
oshchyhol merged 8 commits into
mainfrom
MT-23420-delete-sub-account
Nov 5, 2026
Merged

oshchyhol merged 8 commits into
mainfrom
MT-23420-delete-sub-account

Conversation

@oshchyhol

@oshchyhol oshchyhol commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Sub-accounts can now be deleted from the organization panel, and the same action is exposed over
the public API. DELETE /api/organizations/{organization_id}/sub_accounts/{sub_account_id} is not
described in the spec yet, so it is missing from the rendered reference.

Changes

  • deleteOrganizationSubAccount: new delete operation on
    /api/organizations/{organization_id}/sub_accounts/{sub_account_id}, tagged Organizations,
    reusing the existing organization_id parameter and adding a shared sub_account_id one
    • 204 with no body on success, 401, 403 on insufficient organization permissions, another
      organization's organization_id or the Organization & Sub-accounts feature turned off,
      404 on an unknown, already deleted or other organization's sub-account,
      409 when a deletion for the same sub-account is already running, 429 over the rate limit of
      10 requests per minute per organization
    • the description states that the sub-account and its data are removed permanently, and that
      deleting the organization's last sub-account also deletes the organization
    • code samples for cURL, Node.js, PHP, Python, Ruby, .NET and Java, mirroring the create
      operation; the SDK methods land in the companion PRs below
  • new RateLimitExceededResponse schema and LIMIT_EXCEEDED response for the 429, which the
    spec had no shared definition for
  • the delete description asks for admin permissions for the organization; sub account
    management permissions are not enough

How to test

  • the spec lints clean in CI
  • in the rendered reference, Organizations shows "Delete organization sub account" with the
    organization_id and sub_account_id path params, cURL / Node.js / PHP / Python / Ruby /
    .NET / Java samples, and 204/401/403/404/409/429 responses
  • the 429 example reads {"errors": "Rate limit exceeded"}
  • against the deployed API: DELETE /api/organizations/:organization_id/sub_accounts/:id with
    a token holding Organization & Sub-accounts Admin returns 204 and the sub-account is gone
    from GET /api/organizations/:organization_id/sub_accounts
  • the same DELETE on another sub-account with a token holding Sub-accounts Creation & Listing
    Admin returns 403, and the sub-account is still listed
  • the same call repeated returns 404; with a viewer-level token 403; with no token 401
  • the same DELETE with a sub-account id from another organization returns 404
  • a second DELETE for the same sub-account while the first one is still in flight returns 409
    with {"errors": "Another action in progress. Wait until it's finished"}
  • more than 10 calls within a minute for one organization return 429

Companion PRs

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c8285559-4dc5-49c9-be0c-8d3c30c8af76
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A repeated call for the same sub account returns `404`, because a sub account that is already
scheduled for deletion is no longer listed.

Rate limit: 10 requests per minute per organization.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there specific rate limiting in this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there is one for this endpoint

Comment thread specs/account-management.openapi.yml Resolved
@oshchyhol
oshchyhol removed the request for review from Rabsztok September 11, 2026 10:28
Organization Access Only users and organization API tokens can list, create and delete sub accounts too, so the list, create and delete descriptions name both permissions.
Organization Access Only can't be granted to customers yet, so the list, create and delete descriptions name only the permissions they can hold today.
@oshchyhol
oshchyhol merged commit 9d6e480 into main Nov 5, 2026
2 checks passed
@oshchyhol
oshchyhol deleted the MT-23420-delete-sub-account branch November 5, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants